package com.young.ums.util;


/**
 * 统一用户服务端常量
 * Created by Administrator on 2017/5/8.
 */
public class UmsConstants {
    /**
     * 缓存key前缀
     */
    public interface CACHE_KEY_PRE{
        String SSO_SECURE = "SSO_SECURE_";//安全认证缓存前缀
        String SSO_ACCOUNT_FAIL_LIST = "SSO_ACCOUNT_FAIL_LIST_";//账号登录失败纪录前缀
        String SSO_ACCOUNT_FREEZE = "SSO_ACCOUNT_FREEZE_";//账号冻结前缀
        String UMS_CONFIG = "UMS_CONFIG_";//UMS配置
    }

    /**
     * 资源类型
     */
    public interface NavigateType{
        String MENU = "1";//菜单/导航资源
        String PAGE = "2";//普通页面
        String LOGIC = "3";//逻辑资源
        String URI = "4";//uri资源
    }

    //角色公开枚举值
    public interface RoleOpen{
        int NO_OPEN = 0;//不公开
        int DIRECT_CHILD = 1;//向直属下级公开
        int ALL_CHILD = 2;//向所有下级公开
        int SOME_CHILD = 3;//向部分下级公开
    }

    //删除标志
    public interface TrashFlag{
        int YES = 1;//已删除
        int NO = 0;//未删除
    }

    //用户状态取值
    public interface UserState{
        int YES = 1;//可用
        int NO = 0;//禁用
    }

    //UMS配置状态取值
    public interface UmsConfigState{
        String YES = "1";//可用
        String NO = "0";//禁用
    }

    //SsoSession状态取值
    public interface SsoSessionStatus{
        int YES = 1;//可用
        int NO = 0;//禁用
    }

    //登录日志结果
    public interface LoginLogResult{
        String YES = "1";//成功
        String NO = "0";//失败
    }

    //ums配置key
    public interface UmsConfigKey{
        String LOGIN_IP_BLACK_LIST = "LOGIN_IP_BLACK_LIST";//登录黑名单
        String USER_DEFAULT_PASSWORD = "USER_DEFAULT_PASSWORD";//默认用户密码
        String SSO_RSA_KEY_PRIVATE = "SSO_RSA_KEY_PRIVATE";//加密使用的私钥
        String SSO_RSA_KEY_PUBLIC = "SSO_RSA_KEY_PUBLIC";//加密使用的公钥
        String TOKEN_VALID_TIME = "TOKEN_VALID_TIME";//TOKEN有效时间，单位：秒
        String SSO_COOKIE_DOMAIN = "SSO_COOKIE_DOMAIN";//令牌写入COOKIE的域
        String SSO_DEFAULT_REDIRECT_URL = "SSO_DEFAULT_REDIRECT_URL";//登陆成功后默认下发的重定向地址
        String SSO_HS256_KEY = "SSO_HS256_KEY";//HS256密钥
        String SSO_LOGOUT_REDIRECT_TO = "SSO_LOGOUT_REDIRECT_TO";//注销登录后重定向地址
        String SSO_CONTINUOUS_FAIL_MAX_NUM = "SSO_CONTINUOUS_FAIL_MAX_NUM";//30分钟内连续N次账号密码登录错误则禁止登录,0表示不限制失败次数
        String SSO_CONTINUOUS_FAIL_BAN_SECONDS = "SSO_CONTINUOUS_FAIL_BAN_SECONDS";//连续失败次数过多时封禁账号时长,单位:秒
    }

    //sso与前端交互时使用的秘钥
    public static final String SSO_CLIENT_RSA_KEY_PUBLIC = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCfm68MAkMmCfXPmPz/SSwaOrEQo7lxDKTtm21zgTRoKY5+NTeog9rpUUbpEfKaOxRy7KwF/geOfcR0AWSBJHQkt69d+SuUORIty0pchIjUNGclbxj+LCUlZwyCIuGjBk5CklBdi4NRobHgx2sK4Vkn9oZVsBaQ0yLQ+9OJFva5iQIDAQAB";
    public static final String SSO_CLIENT_RSA_KEY_PRIVATE = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAJ+brwwCQyYJ9c+Y/P9JLBo6sRCjuXEMpO2bbXOBNGgpjn41N6iD2ulRRukR8po7FHLsrAX+B459xHQBZIEkdCS3r135K5Q5Ei3LSlyEiNQ0ZyVvGP4sJSVnDIIi4aMGTkKSUF2Lg1GhseDHawrhWSf2hlWwFpDTItD704kW9rmJAgMBAAECgYEAh6a1u6sgju/gLzSDsiTqitBfNRkxvtdURW3YNFcXx3+qT7HDQEHwiGQ/tE9AtbyIwLRN8DnbCkvx7/ZPCUOGQWR8FDZ7BLHl9EVJXQ8ffWlCwrT9ZCbOOCpF3yBhpJNG5LCtxt4yrZnX5PibGqcQkP3jW0/+X+uQlvPMFYmMA1ECQQDkhfjI4pxDUaHPU7O6twpMkpyj0Tt0wUFQ4maGFPn2s2PC03mgGxPkuKEaxHL4B7ao5DtWHiJWGCpwMcGCNH/rAkEAssx6cobfOqAk1X8KetHu7YwCQnbyloIjQJ9kg43t2bR2GJcp1bTsLveZf1Ch3ZxpwSO5c4j8qbZ+mEQt9IiDWwJAM7/m887lZhVBWErzI3A549c7o5lJJopw+Rkb8Hcll+lNyRvMqiYXni71RLOB+Yr9oUd17G2MhwSX76pE0PCEmwJAYli2wWgOQWD04boPOZ9fnKn2VDi5FrBeU51Y3EOlIKpyivQavsHVZ8ApXi4r2om+Yc4Uo8glsfP/jiFyZZ7xIQJBAIPqU1Fu8xc4+xmuc7Ab2+gDQjK58rGMM7ODOlXuPjB7tkPQCWW5TppCX87y8znn0kT/WAKYSD8wxsOYULIipXA=";

    /**
     * 默认值
     */
    public interface DEFAULT{
        int TOKEN_VALID_TIMES = 1800;//TOKEN有效时间，单位：秒
        String ROOT_DEPT = "ROOT";//部门默认根节点
        String NON_DEPT = "NON";//无单位节点,在young平台中,无单位也被虚拟化为一个单位
        String ROOT_NAVIGATE = "ROOT";//资源默认根节点
        String USER_PASSWORD = "123456";//默认初始密码
        String BUTTON_CATEGORY = "默认分组";//默认的按钮分组
        String BUTTON_CATEGORY_CLONE = "克隆按钮组";//克隆按钮的默认分组
    }


    /**
     * 与文件系统交互常量
     */
    public interface FS{
        String FS_TRANSFER_URI = "fs/file/transferFile.action";//文件传输地址
        String FS_FOLDERID_HEADER = "header";//头像文件夹id
    }



    /**
     * ums配置项的key,根据key值可以取到对应配置
     */
    public interface CONFIG_KEY{
        String SSO_COOKIE_DOMAIN = "SSO_COOKIE_DOMAIN";//单点cookie域配置key值,优先根据此key取域配置项,取不到就使用下面的SSO.DEFAULT_SSO_COOKIE_DOMAIN
        String FS_TRANSFER_URL = "FS_TRANSFER_URL";//文件传输地址配置key
        String SIGN_TOKEN_CHAR = "SIGN_TOKEN_CHAR";//单点token生成时的干扰符
        String LOGIN_IP_BLACK_LIST = "LOGIN_IP_BLACK_LIST";//登录黑名单
    }


    /**
     * 字典值
     */
    public interface DICTIONARY{
        String DEPT_TYPE_COMPANY = "COMPANY";//部门类型为单位
        String DEPT_TYPE_DEPT = "DEPT";//部门类型为部门
        String DEPT_TYPE_OTHER = "OTHER";//部门类型为其他
        String ROLE_TYPE_ADMIN = "1";//管理员角色
        String ROLE_TYPE_NORMAL = "2";//普通角色
    }



    /**
     * sql映射
     */
    public interface MAPPER{
        String UMS_USER = "com.yy.young.ums.mapper.user";//用户
        String UMS_DEPT = "com.yy.young.ums.mapper.dept";//部门
        String UMS_DEPT_USER = "com.yy.young.ums.mapper.deptUser";//部门用户
        String UMS_ROLE = "com.yy.young.ums.mapper.role";//角色
        String UMS_ROLE_USER = "com.yy.young.ums.mapper.roleUser";//角色用户
        String UMS_NAVIGATE = "com.yy.young.ums.mapper.navigate";//资源
        String UMS_APP = "com.yy.young.ums.mapper.app";//应用系统
        String UMS_OUT = "com.yy.young.ums.mapper.out";//对外开放的服务
        String UMS_LGLOG = "com.yy.young.ums.mapper.lglog";//登录日志
        String UMS_CONFIG = "com.yy.young.ums.mapper.config";//登录日志
    }

    /**
     * 单点登录配置
     */
    public interface SSO{
        String DEFAULT_SSO_COOKIE_DOMAIN = "young.com";//token令牌cookie的域
        String SIGN_TOKEN_CHAR = "!";//生成token时的干扰符
        String TOKEN_KEY = "_token";//用户登录信任串的key
        String SSO_LOGIN = "/page/login.jsp";//平台单点登录页面地址,和重定向的差别在于多了个/
        String REDIRECT_LOGIN = "/page/login.html";//重定向到的平台登录页
        String REDIRECT_INDEX_URI_DEF = "portal/";//重定向的默认平台门户首页,page/portal/index.jsp
    }

}
